import { defineStore } from "pinia"
import { reactive, toRefs, computed } from "vue"
/**
 * 组合式api使用
 */
export const useUserStore = defineStore('user', () => {
    const userData = reactive({
        name:"用户名",
        age:26
    })

    const fullName = computed(() => {
        return userData.name + "---------" + userData.age
    })

    function setName() {
        userData.name = '我是用户'
    }

    return {
        userData,
        ...toRefs(userData),
        setName,
        fullName
    }
})